<template>
  <div>
    <Head v-if="isShow"/>
    <router-view/>
    <Foot v-if="isShow"/>
  </div>
  
</template>

<script setup>
import Head from '@/components/Head.vue';
import Foot from '@/components/Foot.vue';
import { useRouter } from 'vue-router';
import { ref } from 'vue';

const isShow = ref(true);
const router = useRouter();

// 某些页面不需要头部
const whiteList = ['/login', '/register'];
router.beforeEach((to, from, next) => {
  //console.log(to.path);
  if (whiteList.includes(to.path)) {
    isShow.value = false;
    // 拦截后放行
    next();
  } else {
    isShow.value = true;
    next();
  }

});
</script>

<style lang="scss" scoped>

</style>